/**
 * 
 */
package com.groovy;

import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptException;

import org.codehaus.groovy.jsr223.GroovyScriptEngineFactory;

/**
 * @author LionBule
 * 2011-5-2 ����09:55:00
 */
public class TestJsr {

	/**
	 * @param args
	 * @throws ScriptException 
	 */
	public static void main(String[] args) throws ScriptException {
		String scriptText = "int i=2; ++i; System.out.println(i);";
		ScriptEngineFactory factory = new GroovyScriptEngineFactory();
		Compilable compilable = (Compilable)factory.getScriptEngine();
		CompiledScript comp = compilable.compile(scriptText);
		comp.eval();
		comp.eval();
	}

}
